jsx3.Class.defineClass(
        "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure", //the full name of the class to create
        jsx3.lang.Object, //  extends
        [tibco.admin.monitormanage.framework.mainPage.MainPageInterface,tibco.admin.plugin.PluginContainerInterface], // implements
        function (plugin) {
        	plugin.machineScreenCacheId = "SPM_MACHINE_SCREEN_CACHE";
        	plugin.nodeScreenCacheId = "SPM_NODE_SCREEN_CACHE";
        	
        	plugin.machineInfoCacheSubject = "com.tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.machineInfoCache";
        	plugin.nodeInfoCacheSubject = "com.tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.nodeInfoCache";
        	plugin.nodePerformRefreshSubject = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.nodePerformRefreshSubject";
        
        	plugin.wsEndpointURL = tibco.admin.monitormanage.framework.mainPage.MainPage.wsEndpointURL;
        
        	plugin.environmentScreenId = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.environmentScreen";
        	plugin.machineScreenId = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.machineScreen";
        	plugin.nodeScreenId = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.nodeScreen";
        	plugin.containerScreenId = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.containerScreen";
        	plugin.servicesScreenId = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.servicesScreen";
        
            plugin.instance = null;
            
            plugin.prototype.allTabs = new Object();
            plugin.prototype.tabsToLoad = new Object();
            
            plugin.prototype.envScreen = null;
            plugin.prototype.machineScreen = null;
            plugin.prototype.nodeScreen = null;
            plugin.prototype.containerScreen = null;
            plugin.prototype.currentlyDisplayedScreen = null;
            
            plugin.prototype.loadingEnvironmentPlugins = false;
            plugin.prototype.loadingNodePlugins = false;
            plugin.prototype.loadingMachinePlugins = false;
            
            plugin.prototype.machineId;
            plugin.prototype.nodeId;
            
            plugin.prototype.pluginsLoaded = false;
            plugin.prototype.displayScreenWaiting = false;
		    plugin.prototype.screenIdWaiting;
		    plugin.prototype.parameterArrayWaiting;
		    
		    plugin.prototype.environmentComponentsHidden = null;
            
            plugin.getInstance = function(args) {
                if(!this.instance) {
                    this.instance = new tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure();
                }
                return this.instance;
            }

            plugin.prototype.getNamespace = function() {
               return "tibco.admin";
            }

            plugin.prototype.getComponentPath = function() {
                return  "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/component.xml"
            }

            plugin.prototype.getTabText = function() {
				return tibco.admin.Main.getServer().getDynamicProperty("@MM@general@GridInfrastructureViewTitle");
            	//return "Grid Infrastructure View";
            }

            plugin.prototype.loadComponent = function(parent) {
            	this.allTabs = new Object();
	            this.tabsToLoad = new Object();
	            this.envScreen = null;
	            this.machineScreen = null;
	            this.nodeScreen = null;
	            this.containerScreen = null;
	            this.currentlyDisplayedScreen = null;
	            this.loadingEnvironmentPlugins = false;
	            this.loadingNodePlugins = false;
	            this.loadingMachinePlugins = false;
	            this.machineId = null;
	            this.nodeId = null;
	            this.pluginsLoaded = false;
	            this.displayScreenWaiting = false;
			    this.screenIdWaiting = null;
			    this.parameterArrayWaiting = null;
			    this.environmentComponentsHidden = null;
            
				tibco.admin.Main.loadResource("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/jss/gridInfrastructureJSS.xml", this.getNamespace(), "SPM_INFRASTRUCTURE_JSS_CACHE", "jss", true);
				tibco.admin.Main.loadResource("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/jss/gridInfrastructureTextJSS.xml", this.getNamespace(), "SPM_INFRASTRUCTURE_TEXT_JSS_CACHE", "ljss", true);

                this.block = tibco.admin.Main.loadUIResource(parent, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/components/gridInfrastructure.xml", true);
                
                this.envScreen = new jsx3.gui.Block("envScreen", 0, 0, "100%", "100%");
                this.block.setChild(this.envScreen);
                this.currentlyDisplayedScreen = this.envScreen;
			}
            
            plugin.prototype.setupPlugin = function(obj) {
            }
            
            plugin.prototype.onAfterGetPlugins = function() {
            	if(this.loadingEnvironmentPlugins)
            	{
            		this.loadingEnvironmentPlugins = false;
            		var headerPaneName = "environmentHeaderPluginPane";
                	var headerClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentHeaderInterface";
                	var tabClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentTabInterface";
                	this.handleExtensionPoints(headerPaneName, headerClassName, tabClassName, "environment", "environmentContentBlock");
            	}
            	else if(this.loadingNodePlugins)
            	{
            		this.loadingNodePlugins = false;
            		var headerPaneName = "nodeHeaderPluginPane";
                	var headerClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeHeaderInterface";
                	var tabClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeTabInterface";
                	this.handleExtensionPoints(headerPaneName, headerClassName, tabClassName, "node", "nodeContentBlock", this.nodeId);
            	}
            	else if(this.loadingMachinePlugins)
            	{
            		this.loadingMachinePlugins = false;
            		var headerPaneName = "machineHeaderPluginPane";
                	var headerClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineHeaderInterface";
                	var tabClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineTabInterface";
                	this.handleExtensionPoints(headerPaneName, headerClassName, tabClassName, "machine", "machineContentPane", this.machineId);
                }
                
                // now check to see if the displayScreen call is waiting for the loaded plugins
				this.pluginsLoaded = true;
				if(this.displayScreenWaiting)
				{ 
					this.displayScreenWaiting = false;
					this.displayScreen(this.screenIdWaiting, this.parameterArrayWaiting); 
				}
            }
            
            plugin.prototype.handleExtensionPoints = function(headerPaneName, headerClassName, tabClassName, tabPrefix, tabContentBlockName, idToPass) {
               	var headerPane = this.block.getDescendantOfName(headerPaneName);
               	var iter = this.getPluginList().iterator();
               	var tabPluginList = new jsx3.util.List();
               	while(iter.hasNext()) {
               	    var obj = iter.next();
               	    if(jsx3.Class.forName(headerClassName).isInstance(obj))
               	    {
               	    	// construct the parent block for the plugin component
               			var parentBlock = new jsx3.gui.Block("pluginParentBlock", 0, 0, obj.getPluginComponentWidth(), "100%");
               			parentBlock.setCSSOverride("float:left");
               			headerPane.setChild(parentBlock);
	               	    obj.loadComponent(parentBlock, idToPass);
            		}
            		else if(jsx3.Class.forName(tabClassName).isInstance(obj))
            		{ tabPluginList.add(obj); }
               	}
               	headerPane.repaint();
               	
               	// handle the tab plugin components
                if(tabPluginList.size() > 0)
                {
                	var contentBlock = this.block.getDescendantOfName(tabContentBlockName);
                	if(tabPluginList.size() == 1)
                	{ 
                		// if there is only one tab component then don't display the tabs
                		tabPluginList.get(0).loadComponent(contentBlock, idToPass); 
                		contentBlock.repaint();
                	}
                	else
                	{
	                	var tabpane = new com.gix.gui.TabbedPane(tabPrefix+"TabbedPane", null, null, "100%", "100%");
	                	contentBlock.setChild(tabpane);
	                	var iter = tabPluginList.iterator();
	                	var first = true;
                		while(iter.hasNext()) 
                		{
                	    	var obj = iter.next();
                	    	var tabId = tabPrefix + "_tab_" + obj.getTabText();
                	    	this.allTabs[tabId] = obj;
                	    	var tab = new com.gix.gui.Tab(tabId, null, null, null, obj.getTabText());
                	    	tab.subscribe(jsx3.gui.Interactive.EXECUTE,this,this.loadTab);
                	    	tabpane.setChild(tab);
                	    	if(first) {
                	    	    obj.loadComponent(tab.getContentPane(), idToPass);
                	    	    first = false;
                	    	}
                	    	else {
                	    	    this.tabsToLoad[tabId] = obj;
                	    	}
                	    }
                	    contentBlock.repaint();
                	}
                }
            }
            
            plugin.prototype.loadTab = function(objEvent) {
               var tabObj = objEvent.target;
               var tabIdPrefix = "";
               if(tabObj.getAncestorOfName("envScreen"))
               { tabIdPrefix = "environment"; }
               else if(tabObj.getAncestorOfName("machineScreen"))
               { tabIdPrefix = "machine"; }
               else if(tabObj.getAncestorOfName("nodeScreen"))
               { tabIdPrefix = "node"; }
               var tabId = tabIdPrefix + '_tab_' + tabObj.getText();
                if(this.tabsToLoad[tabId]) {
                    var obj = this.tabsToLoad[tabId];
                    if(obj) {
                        obj.loadComponent(objEvent.target.getContentPane());
                        delete this.tabsToLoad[tabId];
                    }
                }
                this.allTabs[tabId].tabClicked();
            }
            
            plugin.prototype.getDefaultScreenId = function() {
        		return plugin.environmentScreenId;
        	}

            plugin.prototype.getScreenIds = function() {
            	return [plugin.environmentScreenId, plugin.machineScreenId, plugin.nodeScreenId];
        	}
        	
        	plugin.prototype.buildScreen = function(screenId, parameterArray) {
        		if(screenId == plugin.environmentScreenId)
        		{
	                tibco.admin.Main.loadUIResource(this.envScreen, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/components/environment.xml", true);	                	                
	
	                var envPane = this.envScreen.getDescendantOfName("environmentPane");
	                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.dropdown || !tibco.admin.monitormanage.uicomponents.dropdown.environment || !tibco.admin.monitormanage.uicomponents.dropdown.environment.Environment)
	                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/dropdown/environment/Environment.js", this.getNamespace()); }
	                var environmentsDropdown = tibco.admin.Main.loadUIResource(envPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/dropdown/environment/components/environment.xml", true);
					var environmentLabel = envPane.getDescendantOfName("environmentLabel");
					environmentLabel.setDisplay(jsx3.gui.Block.DISPLAYNONE,true);
        			tibco.admin.monitormanage.general.PageBusUtils.subscribe(tibco.admin.monitormanage.uicomponents.dropdown.environment.Environment.environmentHideComponentsSubject, this.handleEnvironmentHideComponents, this);
					environmentsDropdown.setUpComponent(false, plugin.environmentScreenId, "_MM_infra");
					tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, environmentsDropdown, environmentsDropdown.updateComponent, plugin.environmentScreenId);
					tibco.admin.monitormanage.general.RefreshHandler.register(environmentsDropdown, environmentsDropdown.updateComponent, plugin.environmentScreenId);
	
					var timeframePane = this.envScreen.getDescendantOfName("timeframePane");
	                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.dropdown || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe.Timeframe)
	                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/dropdown/timeframe/Timeframe.js", this.getNamespace()); }
	                var timeframeDropdown = tibco.admin.Main.loadUIResource(timeframePane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/dropdown/timeframe/components/timeframe.xml", true);
	                timeframeDropdown.setUpComponent("_MM_infra", false);
	                
	                var headerPane = this.envScreen.getDescendantOfName("environmentHeaderPane");
	               	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.text || !tibco.admin.monitormanage.uicomponents.text.gridEnvironmentHeader || !tibco.admin.monitormanage.uicomponents.text.gridEnvironmentHeader.GridEnvironmentHeader)
	               	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/text/gridEnvironmentHeader/GridEnvironmentHeader.js", this.getNamespace()); }
	               	var headerObj = tibco.admin.Main.loadUIResource(headerPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/gridEnvironmentHeader/components/gridEnvironmentHeader.xml", true);
	               	headerObj.setUpComponent(plugin.environmentScreenId);
	                   
	                this.loadingEnvironmentPlugins = true;
					var interfaceList = this.getInterfaceList();
					var preloadList = this.getPreloadList();
					this.loadPlugins(interfaceList, preloadList);
				}
        		else if(screenId == plugin.machineScreenId)
        		{
        			// load the machine screen
        			this.machineId = parameterArray.machineId;
        			
        			tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, this, this.updateComponent, plugin.machineScreenId);
        			tibco.admin.monitormanage.general.RefreshHandler.register(this, this.updateComponent, plugin.machineScreenId);
        			
        			this.machineScreen = new jsx3.gui.Block("machineScreen", 0, 0, "100%", "100%");
        			this.block.setChild(this.machineScreen);
        			var machineBlock = tibco.admin.Main.loadUIResource(this.machineScreen, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/components/machine.xml", true);

        			var timeframePane = machineBlock.getDescendantOfName("timeframePane");
                	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.dropdown || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe.Timeframe)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/dropdown/timeframe/Timeframe.js", this.getNamespace()); }
                	var timeframeDropdown = tibco.admin.Main.loadUIResource(timeframePane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/dropdown/timeframe/components/timeframe.xml", true);
                	timeframeDropdown.setUpComponent("_MM_infra");
                	
                	var machineHeaderPane = machineBlock.getDescendantOfName("machineHeaderPane");
        			if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.text || !tibco.admin.monitormanage.uicomponents.text.machineHeader || !tibco.admin.monitormanage.uicomponents.text.machineHeader.MachineHeader)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/text/machineHeader/MachineHeader.js", this.getNamespace()); }
                	var machineHeaderObj = tibco.admin.Main.loadUIResource(machineHeaderPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/machineHeader/components/machineHeader.xml", true);
                	machineHeaderObj.setUpComponent();
        			
					this.loadingMachinePlugins = true;
					var interfaceList = this.getInterfaceList();
					var preloadList = this.getPreloadList();
					this.loadPlugins(interfaceList, preloadList);
        		}
        		else if(screenId == plugin.nodeScreenId)
        		{
        			// load the node screen
        			this.nodeId = parameterArray.nodeId;
        			
        			tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, this, this.updateComponent, plugin.nodeScreenId);
        			tibco.admin.monitormanage.general.RefreshHandler.register(this, this.updateComponent, plugin.nodeScreenId);
        			tibco.admin.monitormanage.general.PageBusUtils.subscribe(plugin.nodePerformRefreshSubject, this.refreshNodeCache, this);
        			
        			this.nodeScreen = new jsx3.gui.Block("nodeScreen", 0, 0, "100%", "100%");
        			this.block.setChild(this.nodeScreen);
        			var nodeBlock = tibco.admin.Main.loadUIResource(this.nodeScreen, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/components/node.xml", true);
        			
        			var timeframePane = nodeBlock.getDescendantOfName("timeframePane");
                	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.dropdown || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe.Timeframe)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/dropdown/timeframe/Timeframe.js", this.getNamespace()); }
                	var timeframeDropdown = tibco.admin.Main.loadUIResource(timeframePane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/dropdown/timeframe/components/timeframe.xml", true);
                	timeframeDropdown.setUpComponent("_MM_infra");
                	
                	var breadcrumbPane = nodeBlock.getDescendantOfName("breadcrumbPane");
                	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.misc || !tibco.admin.monitormanage.uicomponents.misc.breadcrumb || !tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/misc/breadcrumb/Breadcrumb.js", this.getNamespace()); }
                	var bc = tibco.admin.Main.loadUIResource(breadcrumbPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/misc/breadcrumb/components/breadcrumb.xml", true);
                	bc.setUpComponent("_MM_infra", false, tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb.displayTypeNode, plugin.nodeInfoCacheSubject, plugin.nodeScreenCacheId);
                	//bc.setUpComponent(false, tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb.displayTypeNode, plugin.nodeInfoCacheSubject, plugin.nodeScreenCacheId);
                	
                	var nodeHeaderPane = nodeBlock.getDescendantOfName("nodeHeaderPane");
        			if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.text || !tibco.admin.monitormanage.uicomponents.text.nodeHeader || !tibco.admin.monitormanage.uicomponents.text.nodeHeader.NodeHeader)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/text/nodeHeader/NodeHeader.js", this.getNamespace()); }
                	var nodeHeaderObj = tibco.admin.Main.loadUIResource(nodeHeaderPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/nodeHeader/components/nodeHeader.xml", true);
                	nodeHeaderObj.setUpComponent();
                	
					this.loadingNodePlugins = true;
					var interfaceList = this.getInterfaceList();
					var preloadList = this.getPreloadList();
					this.loadPlugins(interfaceList, preloadList);
        		}
			}
        	
        	plugin.prototype.getPreloadList = function() {
        		// preload the tabs
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.environmentOverview || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.environmentOverview.EnvironmentOverview)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/tabContent/environmentOverview/EnvironmentOverview.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.machineOverview || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.machineOverview.MachineOverview)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/tabContent/machineOverview/MachineOverview.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.nodeOverview || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.nodeOverview.NodeOverview)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/tabContent/nodeOverview/NodeOverview.js", this.getNamespace()); }
                    
                var preloadList = new jsx3.util.List();
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.environmentOverview.EnvironmentOverview);
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.machineOverview.MachineOverview);
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.tabContent.nodeOverview.NodeOverview);
                return preloadList;
        	}
        	
        	plugin.prototype.getInterfaceList = function() {
        		if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineHeaderInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/MachineHeaderInterface.js", this.getNamespace()); }
				if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineTabInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/MachineTabInterface.js", this.getNamespace()); }
				if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeHeaderInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/NodeHeaderInterface.js", this.getNamespace()); }
				if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeTabInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/NodeTabInterface.js", this.getNamespace()); }
				if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentHeaderInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/EnvironmentHeaderInterface.js", this.getNamespace()); }
				if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure || !tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentTabInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/EnvironmentTabInterface.js", this.getNamespace()); }
				var loadList = new jsx3.util.List();
				loadList.add("tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeHeaderInterface");
				loadList.add("tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeTabInterface");
				loadList.add("tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineHeaderInterface");
				loadList.add("tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineTabInterface");
				loadList.add("tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentHeaderInterface");
				loadList.add("tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentTabInterface");
				return loadList;
        	}
        	
        	plugin.prototype.handleEnvironmentHideComponents = function(subject, message, infrastructureObj) {
        		if(infrastructureObj.currentlyDisplayedScreen == infrastructureObj.envScreen)
        		{
        			if(infrastructureObj.environmentComponentsHidden == null || infrastructureObj.environmentComponentsHidden != message.environmentHideComponents)
        			{
	        			var displayStyle;
	        			var instruxDisplayStyle;
						var rows;
						if(message.environmentHideComponents)
	        			{ 
	        				displayStyle = jsx3.gui.Block.DISPLAYNONE; 
	        				instruxDisplayStyle = jsx3.gui.Block.DISPLAYBLOCK;
	        				infrastructureObj.environmentComponentsHidden = true;
							rows = "25,36,43,20,*";				//display instruction pane
						}
	        			else
	        			{
	        				displayStyle = jsx3.gui.Block.DISPLAYBLOCK;
	        				instruxDisplayStyle = jsx3.gui.Block.DISPLAYNONE; 
	        				infrastructureObj.environmentComponentsHidden = false;
							rows = "25,36,43,0,*";				//hide instruction pane
						}
	        			
	        			var headerBlock = infrastructureObj.envScreen.getDescendantOfName("secondPane");
	        			if(headerBlock.getDisplay() != displayStyle)
	        			{ headerBlock.setDisplay(displayStyle, true); }
	        			
	        			var contentBlock = infrastructureObj.envScreen.getDescendantOfName("environmentContentBlock");
						if(contentBlock.getDisplay() != displayStyle)
	        			{ contentBlock.setDisplay(displayStyle, true); }
	        			
	        			var instruxBlock = infrastructureObj.envScreen.getDescendantOfName("instructionPane");
						instruxBlock.getParent().setRows(rows,true);				//hide instruction pane

						if(instruxBlock.getDisplay() != instruxDisplayStyle)
	        			{ instruxBlock.setDisplay(instruxDisplayStyle, true); }
        			}
        		}
        	}
        	
        	plugin.prototype.updateComponent = function() {
        		if(this.currentlyDisplayedScreen == this.machineScreen)
				{ this.callGetMachines(); }
				else if(this.currentlyDisplayedScreen == this.nodeScreen)
				{ this.callGetNodes(); }
			}
        
        	plugin.prototype.displayScreen = function(screenIdVal, parameterArray) {
        		if(this.pluginsLoaded)
        		{
	        		this.currentlyDisplayedScreen.setDisplay(jsx3.gui.Block.DISPLAYNONE);
        		
	        		var idForPluginClass;
	        		var message = {screenId:screenIdVal};
	        		var tabClassName;
	        		var headerClassName;
					if(screenIdVal == plugin.machineScreenId)
					{
						headerClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineHeaderInterface";
						tabClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.MachineTabInterface";
						idForPluginClass = parameterArray.machineId;
						message.machineId = parameterArray.machineId;
						this.machineId = parameterArray.machineId;
						this.currentlyDisplayedScreen = this.machineScreen;
						this.callGetMachines();
					}
					else if(screenIdVal == plugin.nodeScreenId)
					{
						headerClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeHeaderInterface";
						tabClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.NodeTabInterface";
						idForPluginClass = parameterArray.nodeId;
						message.nodeId = parameterArray.nodeId; 
						this.nodeId = parameterArray.nodeId;
						this.currentlyDisplayedScreen = this.nodeScreen;
						this.callGetNodes();
					}
					else if(screenIdVal == plugin.environmentScreenId)
					{
						headerClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentHeaderInterface";
						tabClassName = "tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.EnvironmentTabInterface";
						if(parameterArray)
						{ 
							message.environmentId = parameterArray.environmentId; 
							idForPluginClass = parameterArray.environmentId;
						}
						this.currentlyDisplayedScreen = this.envScreen; 
					}
					
					// notify the components that they need to display 
					tibco.admin.monitormanage.general.PageBusUtils.publish(tibco.admin.monitormanage.general.NavigationHandler.mainPageDisplayTopic, message);
					
					// notify the plugin components that they need to display
					var iter = this.getPluginList().iterator();
    	           	while(iter.hasNext()) {
        	       	    var obj = iter.next();
        	       	    if(jsx3.Class.forName(headerClassName).isInstance(obj) || jsx3.Class.forName(tabClassName).isInstance(obj))
                	    { obj.updateComponent(idForPluginClass); }
                	}
					
					this.currentlyDisplayedScreen.setDisplay(jsx3.gui.Block.DISPLAYBLOCK);
		        	this.block.repaint();
				}
		        else
		        {
		        	this.displayScreenWaiting = true;
		        	this.screenIdWaiting = screenIdVal;
		        	this.parameterArrayWaiting = parameterArray;
		        }
        	}
        	
        	plugin.prototype.mainPageTabSelected = function() {
        	/*
        		// the main page tab was selected...make sure we go to the environment screen
        		if(this.envScreen.getDisplay() == jsx3.gui.Block.DISPLAYNONE)
        		{
        			this.currentlyDisplayedScreen.setDisplay(jsx3.gui.Block.DISPLAYNONE);
        			this.currentlyDisplayedScreen = this.envScreen;
        			this.envScreen.setDisplay(jsx3.gui.Block.DISPLAYBLOCK);
        			this.block.repaint();
        		}
        		*/
        	}
    		
    		//call this method to begin the service call (eg.service.callgetMachines();)
    		plugin.prototype.callGetMachines = function() {
    			if (tibco.admin.Main.getServer().getEnv("MODE")) {
                    // mode is live
                    var objService = tibco.admin.Main.loadService(this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/rules/machineRules.xml", "getMachines");
                    objService.setEndpointURL(plugin.wsEndpointURL);
		    		// this setInboundURL should not be required...only here because of a current AMX framework bug
		    		objService.setInboundURL("tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/data/machineData.xml");
                }
                else {
                    var objService = new jsx3.net.Service(tibco.admin.Main.resolveURI(this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/rules/machineRules.xml"), "getMachines", null, null);
                    // mode is static
                    objService.setInboundURL(tibco.admin.Main.resolveURI(this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/data/machineData.xml"));
                }
                
                objService.machineId = this.machineId;
                
                // initialize the list of metrics we wish to retrieve data for
				var metricsList = new jsx3.util.List();
				metricsList.add("OS");
				metricsList.add("tibHome");
				metricsList.add("memoryInUse");
				metricsList.add("totalMemory");
				metricsList.add("status");
				objService.metricsList = metricsList;

      			//subscribe and call
      			objService.subscribe(jsx3.net.Service.ON_SUCCESS, this.ongetMachinesSuccess);
      			objService.subscribe(jsx3.net.Service.ON_ERROR, this.ongetMachinesError);
      			objService.subscribe(jsx3.net.Service.ON_INVALID, this.ongetMachinesInvalid);
      			objService.doCall();
    		};

    		plugin.prototype.ongetMachinesSuccess = function(objEvent) {
      			//var responseXML = objEvent.target.getInboundDocument();
      			//jsx3.log("Success","The service call was successful.");
      			
      			var message = { initialized:true };
        		tibco.admin.monitormanage.general.PageBusUtils.publish(plugin.machineInfoCacheSubject, message);
    		};

    		plugin.prototype.ongetMachinesError = function(objEvent) {
      			var myStatus = objEvent.target.getRequest().getStatus();
      			jsx3.log("Error","The service call failed. The HTTP Status code is: " + myStatus);
    		};

    		plugin.prototype.ongetMachinesInvalid = function(objEvent) {
      			jsx3.log("Invalid","The following message node just failed validation:\n\n" + objEvent.message);
    		};
    		
    		plugin.prototype.refreshNodeCache = function(subject, message, infrastructureObj) {
        		infrastructureObj.callGetNodes();
        	}
    		
    		//call this method to begin the service call (eg.service.callgetNodes();)
    		plugin.prototype.callGetNodes = function() {
    			var rulesURI = "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/rules/nodeRules.xml";
    			var dataURI = "tibco/admin/monitormanage/uicomponents/page/gridInfrastructure/data/nodeData.xml";
    			if (tibco.admin.Main.getServer().getEnv("MODE")) {
                    // mode is live
                    var objService = tibco.admin.Main.loadService(this.getNamespace(), rulesURI, "getNodes");
                    objService.setEndpointURL(plugin.wsEndpointURL);
		    		// this setInboundURL should not be required...only here because of a current AMX framework bug
		    		objService.setInboundURL(dataURI);
                }
                else {
                    var objService = new jsx3.net.Service(tibco.admin.Main.resolveURI(this.getNamespace(), rulesURI), "getNodes", null, null);
                    // mode is static
                    objService.setInboundURL(tibco.admin.Main.resolveURI(this.getNamespace(), dataURI));
                }
                
                objService.nodeId = this.nodeId;
                objService.timeframeId = tibco.admin.monitormanage.uicomponents.dropdown.timeframe.Timeframe.getCurrentTimeframeId();
                
                // initialize the list of metrics we wish to retrieve data for
				var metricsList = new jsx3.util.List();
				metricsList.add("description");
				metricsList.add("installDate");
				metricsList.add("installedBy");
				metricsList.add("messagingServer");
				metricsList.add("startDate");
				metricsList.add("availability");
				metricsList.add("status");
				metricsList.add("faults");
				metricsList.add("successes");
				metricsList.add("machine");
				metricsList.add("machineKey");
				metricsList.add("memoryInUse");
				metricsList.add("totalMemory");
				metricsList.add("upTime");
				metricsList.add("cpuTime");
				metricsList.add("environmentName");
				metricsList.add("environmentKey");
				objService.metricsList = metricsList;

      			//subscribe and call
      			objService.subscribe(jsx3.net.Service.ON_SUCCESS, this.ongetNodesSuccess);
      			objService.subscribe(jsx3.net.Service.ON_ERROR, this.ongetNodesError);
      			objService.subscribe(jsx3.net.Service.ON_INVALID, this.ongetNodesInvalid);
      			objService.doCall();
    		};

    		plugin.prototype.ongetNodesSuccess = function(objEvent) {
      			//var responseXML = objEvent.target.getInboundDocument();
      			//jsx3.log("Success","The service call was successful.");
      			
      			var message = { initialized:true };
        		tibco.admin.monitormanage.general.PageBusUtils.publish(plugin.nodeInfoCacheSubject, message);
    		};

    		plugin.prototype.ongetNodesError = function(objEvent) {
      			var myStatus = objEvent.target.getRequest().getStatus();
      			jsx3.log("Error","The service call failed. The HTTP Status code is: " + myStatus);
    		};

    		plugin.prototype.ongetNodesInvalid = function(objEvent) {
      			jsx3.log("Invalid","The following message node just failed validation:\n\n" + objEvent.message);
    		};
        });